NESWrite
--------
by Matrixz 2001-2002
Version 2.10

What's New?
-----------

 Version 2.10
  - Color Selection Works
    After File Open
  - "J" and "K" keys
    updates graphics
  - A graphical surprise
  - Text gfx bugfix
  - Fixed manual

 Version 2.01
  - Added Matrixz' Palette 2
  - Included Source Code
  - Tile Colors are updated when
    a palette is loaded
  - Updated manual a byte

 Version 2.00
  - Included CHR Extract / Insert
  - Graphics "above" mouse doesn't
    mess up anymore
  - Added file description
    in manual
  - Tilesearch string input returns
    when above 12, it doesn't exit
    the whole thing anymore.
  - Blank file open input
    returns to main edit
  - Right-Mouseclick graphics
    updates now. (It's fast as
    well).
  - "W" and "Y" keys gives correct
    end offsets.
  - Pointing in the middle of two
    Patterns doesn't give 4 bit HEX
    values anymore
  - Graphics is updated
    at "Search Again"

 Version 1.11
  - I was a little too fast with 1.10,
    some gfx didn't update, but now
    everything's fine.
  - Text Table file starts as $10 when opening
  - Fixed a lill' display bug
  - And a lill' tile pick bug

 Version 1.10
  - A lot faster graphics
  - Fixed the sync between tile and palette colors
  - Better file open handling
  - Updated Manual
  - Edit Position is set to 0 when search result is found
  - Edit Position limits (0 to 255)

What Is NESWrite?
-----------------
This program is *NOT* the first tile-based text hacking tool. (Ater i finnaly got Xlate 3.0
working, i noticed it let's edit ROM using a font you can modify with tiles). But anyway this
program is very different. You load up a Pattern Table from the ROM / CHR-ROM, then use
this as your font for text modifying. Now you can walk a round in the ROM for text, or search,
using tiles or text input. You can also swap between two Pattern Table files for translation
purpose. How Easy! Now you don't need to MAKE tables anymore, you FIND em'. Other arguments
for that tiles is better, is that not all characters can be displayed as good ascii text
using a table (Especially not Japanese characters), and maybe NESWrite can be used in some
types of graphics editing? The problem is that searching makes your coffee breaks becouse
QuickBasic is so Slow (Now ain't that a Paradox?). I really hope this program will inspire to
other coming text hacking tools in this generation. I'm actually working on my plan, to make
a new tool, with better graphics and support for many CHR formats.

Other
-----
All comments and bug reports are welcome at: ingegjoestoel@yahoo.co.uk or matrixz15@yahoo.co.uk
This is the final relase, unless someone spots a hidden bug, or
something else occurs.

If you like this program, yo'll like my page: http://matrixz.freeservers.com

Big Tanks to:
 Anders Andersson - For The Mouse Code
 Ryan Williams - Notes on how to use 'Absolute' commands in QB 4.5.
 BMF54123 - For his palette (visit his home at: http://bmf.rustedmagick.com)
 All The NES ROM Entusiastists in the wide world for inspiration.
 Anti Resonance - For writing SNESAmp, enabling me to listen to
                  my favourite working music!
 And YOU, for using this program.

Elements that halted the project:
 SCHOOL - I have a revolutionary antischool page :<

NOTE: Use this program at your own risk, it's quite dangerous.
I take no responsibility for what negative it may cause you or your ownings.
It may make you crazy on romhacking, regardless of the person who
is using this program.

ok let's be serious (only for a while heheee..)
NOTE: Writes is done directly to the ROM, there's no Save or Undo.
YOU MUST BACKUP YOUR ROMS OR YOU MIGHT CORRUPT THEM BY ACCIDENT!

Feel free to put this program on your site or wherever you want if u want

Files
-----

Palettes:
MATRX2F.PAL - My new and very nature-true palette
BMFFINR1.PAL - BMF54123's palette (Final Revision 1)
NESTICLE.PAL - The overcontrasted palette included with NESticle (vX.XX)

The reason why i included these differences was to make it fit with all works (different
hacks is tested using different emulator's palettes).

NESWRITE.TXT - It'ss.. Ummm.. Oh yeah! This file! Hum..
MATRX2.TXT - Readme to Matrixz Palette 2
BMFFINR1.TXT - The readme to BMF54123's palette
NESWRITE.EXE - Well, it's a computer file i guess?
NESWRITE.CHR - A blank file used to feed NESWRITE.EXE
NESWRITE.CFG - Configuration file
SSTR.DAT - A Search string config file (Couldn't somehow be included in NESWRITE.CFG)

You should extract all the files to a folder, or it may not work.
You do not need to run it from a boring DOS-Prompt.

NESWSRC.TXT - Source Code Information (must read first)
NESWSRC.BAS - Version 2.01 QuickBasic 4.5 Sourche Code

Useful Notes
------------

 * The NES screen is built up of 8x8 pixel tiles. The tile resoultion
   is 32x28. Each tile on the screen can be 1 of 256, 4 color tiles. All
   the 256 tiles is kept in what we mostly call the bg Pattern Table (or Tile Table).
   So, what you do is to locate a Pattern Table with a text font from the ROM
   and search in the ROM for text data where this Pattern Table is used.

 * A tile is 2-bit (4 color) and is on 16 ($10) bytes. Therefore, a tile
   offset is the byte offset divided on 16 ($10).
   Fex. Tile offset $180 is byte offset $1800.

Config Load/Save
----------------
An configuration file is automatically saved when you exit,
and loads when you open NESWrite. The data includes the files currently opened,
the current Palette file, the offsets you are in, search options, text search
position and the colors. So if you are like me, you wanna see the changes after a
text editing, and when you go back to change more, you don't need to load everyting
again and again.

File Menu
---------

Open File

  OPEN FILE, opens a file for both Pattern Table (Left) and Text Table (Right).
  OPEN FILE 1, opens a file for Pattern Table only. (Both Swaps)
  OPEN FILE 1A, opens a file for Pattern Table Swap A.
  OPEN FILE 1B, opens a file for Pattern Table Swap B.
  OPEN FILE 2, opens a file for Text Table only.

  If you leave the file input field blank, you will go back to the main editing.

  NOTE: File offsets starts on &H10, so you don't need to worry to skip the NES Header.

Load .PAL file

  Load an alternate NES Palette.

Exit

  This is what you do when the house's on fire.

Edit Menu
---------

Search Tiles..

  Search in the Text Table file using tiles.

  Click in the little window to pick the tiles from the Pattern Table on the left. To undo
  a selection, press Right mousebutton or backspace. Press enter when you're done.

  The Start is the perthousand offset, (it's Start/1000, where 1000 is the end
  of the file.

  Press "Search" to begin the search, or "Cancel" or outside the window to go back.

  As soon as a set of tiles is equal to the search, the search stops, and the result found
  will start on the first tile in the Text Table. While searching, you can press "Esc" to
  abort the search. You can continue the search on "Search Again" in the "Edit" menu.

Search Text..

  Search in the Text Table file for text.

  Some values are needed for the program to know where in the Pattern Table the tiles for
  the fonts are. The Uppercase A, the start of the Uppercase Alphabet, the Lowercase A,
  the start of the Lowercase Alphabet, and the Zero (0), the start of the numbers from
  0 to 9. The "A=" means wich tile in the Pattern Table that is the Uppercase A in the
  current Pattern Table. You can input wich one it is, or grab it with the mouse.
  The "a=" is the lowercase a, the start of the Lowercase Alpabet. "0=" is the start of
  the numbers from 0 to 9.

  Now Input your search string in the little window.

Search Again

  If you have pressed escape during search, you can use this to continue, if you have
  found a result on the search, use it to search for more results. The counter with the
  offset a search will continue on, is stated in the configuration file as well.

Tile Menu
---------

Extract CHR..

  Extract a piece of CHR from the current Pattern Table.

  "From $", is the tile to start extracting from (the first tile).
  "To $", is the tile to end extracting on (the last tile).
  "File:" is the file to output the extract to.

  For exmaple, from $00 to $FF extracts the whole Pattern
  Table to a file.

Insert CHR..

  Insert a piece of CHR from a .CHR or .NES ROM file.

  "From $", is the tile to start insert on (the first tile).
  "To $", is the tile to end insert on (the last tile).
  "File:" is the file to input the CHR from.
  "Offset $" is the tile offset in the input CHR file to start reading from
             (remember to add one for NES ROM's to skip the 16-byte header)

  For exmaple, from $00 to $FF with offset $100 inserts 256 tiles
  in the chosen file at tile offset $100 (byte offset $1000) to the whole Pattern Table.

Operating Keys
--------------

 F1: Turn On/Off Background Graphics

 Pattern Table:
  Q / W: Goto Start / End of Pattern Table file
  A / S: Decerase / Incerase Pattern Table Set ($1000, 256 tile bank)
  Z / X: Decerase / Incerase Tile Line (16 tiles)
  E / R: Decerase / Incerase 1 Tile
  D / F: Decerase / Incerase 1 Byte

 Text Table:
  T / Y: Goto Start / End of Text Table file
  G / H: Decerase / Incerase Text Page (256 bytes)
  B / N: Decerase / Incerase Text Line (16 bytes)
  U / I: Decerase / Incerase 1 Byte
  J / K: Decerase / Incerase Edit Position

The Main Editing
----------------
The red window in the Text Table indicates the Edit Position, where writing is done. You
can move this window to where you will write to. When you have found the correct position
in the Text Table file where you will modify text, click on the tile in the Pattern Table
you will write to the Edit Position. After a write, the Edit Position will incerase.
If you press Right mousebutton in the Text Table, the tile in the Edit Position
will be copied to the position you clicked to.

File Swapping
-------------
You can swap the Pattern Table file between Swap A and B. Swap using the TAB key.
It will help you so you can use one Pattern Table with clean Japanese characters to read
with, and an other to write with clean English characters.
Here's an example on how to do it:

Copy the original, unchanged ROM of the game to the NESWrite folder (We'll call it file A),
copy this file as another file (file B) in the same folder, this is the file you will be
changing (If you wanna use NESWrite to continue a translated ROM, the worked file will
be the second file, the one to change). If you need to create an english (or the leangue
you will translate to) font in file B, do it. (You may use the CHR Inserter to do it).
Now open NESWrite, and open the file for editing (file B) in OPEN FILE 1. Open the
unchanged file(file A) in OPEN FILE 1A. Now you can swap between these two. Swap to the
unchanged ROM (A), and find the Japanese (or the leangue you will translate from)
CHR character set, and fint the text you wanna edit. Then you can swap to the other file (B) wich
have the English (or whatever font) and then write the text in English. On this method,
you can read the text in clean Japanese using the Pattern Table in file A, and English with
the English font in the other file B.

-----

That's All! It was [even more] much, but i feel for 
making it scrupulous, so that everyone understands.
Go do some exciting works! :-]